package de.java.hsrm.view.panels;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.*;

import de.java.hsrm.app.DataManager;


@SuppressWarnings("serial")
public class MainPanel extends JPanel{
	
	private JButton startBtn;
	private JButton stopBtn;
	private JTextField nameTxtfield;
	private JTextArea textArea;
	private DataManager dataManager;
	
	public MainPanel(DataManager dm){
		this.dataManager = dm;
		initialize();
		build();
	}
	
	private void initialize() {
		this.startBtn = new JButton("Start");
		this.stopBtn = new JButton("Stop");
		this.nameTxtfield = new JTextField();
		this.textArea = new JTextArea();
		
		this.startBtn.putClientProperty("JComponent.sizeVariant","small" );
	}

	private void build() {
		setLayout(new BorderLayout());
		add(this.nameTxtfield,BorderLayout.NORTH);	
		add(this.startBtn,BorderLayout.WEST);
		add(this.stopBtn,BorderLayout.EAST);
		add(new JScrollPane(this.textArea),BorderLayout.CENTER);
		
		initActionButtons();
	}

	private void initActionButtons(){
		this.startBtn.addActionListener(new ActionListener(){
			@Override public void actionPerformed(ActionEvent e) {
					
			}	
		});
		this.startBtn.addMouseListener(new MouseAdapter(){
			public void mouseEntered(MouseEvent e){
				startBtn.setBackground(getBackground());
			}
		});
	}

	public JButton getStartBtn() {
		return startBtn;
	}

	public JTextField getNameTxtfield() {
		return nameTxtfield;
	}

	public JTextArea getTextArea() {
		return textArea;
	}

}
